﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="departments.aspx.cs" Inherits="school_departments" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script src="../include/js/form.js" type="text/javascript"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyContentTop" runat="Server">
    <h1>
        Departments</h1>
    <h3>
        How many departments have in selected school?</h3>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bodyContent" runat="Server">
    <div class="elements_inner_wrapper">
        <div id="contentBody">
            <div class="section">
                <div class="seperator">
                </div>
                <fieldset class="formouter">
                    <table cellpadding="3" cellspacing="3" width="100%">
                        <tr>
                            <td colspan="2">
                                <div class="row_curved" id="divSchoolList" runat="server" title="Example:UCSM, MIT, YTU">
                                    <label for="<%=ddlSchoolList.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Selected School Name" ID="Label2" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:DropDownList AutoPostBack="True" runat="server" ID="ddlSchoolList" OnSelectedIndexChanged="ddlSchoolList_SelectedIndexChanged"
                                                DataSourceID="odsSchoolProfileList" DataTextField="ListText" DataValueField="ListValue" />
                                            <asp:ObjectDataSource ID="odsSchoolProfileList" runat="server" DataObjectTypeName="SIS.ENT.Listing"
                                                DeleteMethod="Delete" OldValuesParameterFormatString="original_{0}" SelectMethod="GetList"
                                                TypeName="SIS.BLL.ListingManager" UpdateMethod="Save">
                                                <SelectParameters>
                                                    <asp:Parameter DefaultValue="1" Name="ListType" Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:RequiredFieldValidator ID="rfvSchoolList" ValidationGroup="Department" ControlToValidate="ddlSchoolList"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage="<br/>Please select a school name.<br/>"></asp:RequiredFieldValidator>
                                            &nbsp;&nbsp;
                                            <asp:Button Visible="false" runat="server" ID="btnShowDepartment" Text="Show" OnClick="btnShowDepartment_Click" />
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divLocation" runat="server" title="Example:UCSM, MIT, YTU">
                                    <label for="<%=ddlLocation.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Location Name" ID="lblLocation" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:DropDownList AutoPostBack="True" runat="server" ID="ddlLocation" OnSelectedIndexChanged="ddlLocation_SelectedIndexChanged"
                                                DataSourceID="odsStandarLevel" DataTextField="LocationName" DataValueField="LocationKey"
                                                Style="height: 22px" />
                                            <asp:ObjectDataSource ID="odsStandarLevel" runat="server" OldValuesParameterFormatString="original_{0}"
                                                SelectMethod="GetList" TypeName="SIS.BLL.LocationTableManager">
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="ddlSchoolList" Name="SchoolKey" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:RequiredFieldValidator ID="rfvLocation" ValidationGroup="ClassRoom" ControlToValidate="ddlLocation"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage="<br/>Please select a standard level.<br/>"></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <h2>
                                    Listing</h2>
                                <asp:GridView ID="grvDepartment" runat="server" AutoGenerateColumns="False" DataKeyNames="DepartmentKey,SchoolKey,LocationKey"
                                    CellPadding="4" Width="650px" DataSourceID="odsDepartment" ForeColor="#333333"
                                    GridLines="None" OnSelectedIndexChanged="grvDepartment_SelectedIndexChanged">
                                    <RowStyle BackColor="#EFF3FB" />
                                    <Columns>
                                        <asp:BoundField DataField="DepartmentKey" HeaderText="DepartmentKey" InsertVisible="False"
                                            ReadOnly="True" SortExpression="DepartmentKey" Visible="False" />
                                        <asp:BoundField DataField="SchoolKey" HeaderText="SchoolKey" InsertVisible="False"
                                            ReadOnly="True" SortExpression="SchoolKey" Visible="False" />
                                        <asp:BoundField DataField="DepartmentCode" HeaderText="Code" SortExpression="DepartmentCode" />
                                        <asp:BoundField DataField="DepartmentName" HeaderText="Name" SortExpression="DepartmentName" />
                                        <asp:BoundField DataField="DepartmentDescription" HeaderText="Description" SortExpression="Description" />
                                        <asp:CheckBoxField DataField="Status" HeaderText="Status" SortExpression="Status" />
                                        <asp:BoundField DataField="CreatedDateTime" HeaderText="CreatedDateTime" SortExpression="CreatedDateTime"
                                            Visible="False" />
                                        <asp:BoundField DataField="ModifiedDateTime" HeaderText="ModifiedDateTime" ReadOnly="True"
                                            SortExpression="ModifiedDateTime" />
                                        <asp:CommandField ButtonType="Button" ShowSelectButton="True" />
                                    </Columns>
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <EmptyDataTemplate>
                                        No department found.
                                    </EmptyDataTemplate>
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#2461BF" />
                                    <AlternatingRowStyle BackColor="White" />
                                </asp:GridView>
                                <asp:ObjectDataSource ID="odsDepartment" runat="server" DataObjectTypeName="SIS.ENT.DepartmentTable"
                                    DeleteMethod="Delete" OldValuesParameterFormatString="original_{0}" SelectMethod="GetList"
                                    TypeName="SIS.BLL.DepartmentTableManager" UpdateMethod="Save" InsertMethod="Save">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="ddlSchoolList" Name="SchoolKey" PropertyName="SelectedValue"
                                            Type="Int32" />
                                        <asp:ControlParameter ControlID="ddlLocation" Name="LocationKey" PropertyName="SelectedValue"
                                            Type="Int32" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" valign="top">
                                <div>
                                    <asp:ValidationSummary ID="vsDepartment" runat="server" ValidationGroup="Department"
                                        ShowSummary="True" HeaderText="Please complete all highlighted fields of the form. Thank you."
                                        CssClass="errorSummary" />
                                    <asp:Label Visible="true" runat="server" Text="-1" ID="lblSchoolKey" />
                                    <asp:Label Visible="true" runat="server" Text="-1" ID="lblLocationKey" />
                                    <asp:Label Visible="true" runat="server" Text="-1" ID="lblDepartmentKey" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <h2>
                                    Department Details
                                </h2>
                                <div class="row_curved" id="divDepartmentCode" runat="server" title="Example:B.C.Sc, BEHS, M.B.B.S">
                                    <label for="<%=txtDepartmentCode.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Code" ID="lblDepartmentCode" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:TextBox Width="220px" ID="txtDepartmentCode" MaxLength="50" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvDepartmentCode" ValidationGroup="Department" ControlToValidate="txtDepartmentCode"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divName" runat="server">
                                    <label for="<%=txtDepartmentName.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Name" ID="lblDepartmentName" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:TextBox Width="270px" ID="txtDepartmentName" MaxLength="255" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvDepartmentName" ValidationGroup="Department" ControlToValidate="txtDepartmentName"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divDescription" runat="server">
                                    <label for="<%=txtDescription.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Description" ID="lblDescription" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:TextBox Width="270px" ID="txtDescription" MaxLength="255" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvDescription" ValidationGroup="Department" ControlToValidate="txtDescription"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divStatus" runat="server">
                                    <label for="<%=chkStatus.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Status" ID="lblStatus" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:CheckBox ID="chkStatus" runat="server" Text="" Checked="true" />
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="row_curved" style="background-color: #efefef;" id="divButton" runat="server">
                                    <label>
                                        &nbsp;</label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:Button ID="btnSubmit" CssClass="button_normal_submit" Text="Save" ValidationGroup="Department"
                                                OnClientClick="SubmitOnClientClick(this, 'Department');" runat="server" OnClick="btnSubmit_Click" /></span>
                                        &nbsp;&nbsp;<asp:Button runat="server" ID="btnAddNew" Text="New" OnClick="btnAddNew_Click" />
                                        &nbsp;&nbsp;<asp:Button runat="server" ID="btnDelete" OnClientClick="return confirm('Are you sure to delete?');"
                                            Text="Delete" OnClick="btnDelete_Click" />
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divMessage" runat="server">
                                    <label>
                                        &nbsp;</label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:Label ID="lblMessage" Font-Bold="true" runat="server"></asp:Label>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        //<![CDATA[
        SetSumitNormalButtonAttribute(document.getElementById('<%=btnSubmit.ClientID%>'));
        //]]>
    </script>

</asp:Content>
